import AdminUserManagerView from '@/views/AdminUserManagerView.vue'
import HomeView from '@/views/HomeView.vue'
import Layout from '@/views/Layout.vue'
import LoginView from '@/views/LoginView.vue'
import LunboManagerView from '@/views/LunboManagerView.vue'
import OrderManagerView from '@/views/OrderManagerView.vue'
import ProductManagerView from '@/views/ProductManagerView.vue'
import RibaoManagerView from '@/views/RibaoManagerView.vue'
import TodoManagerView from '@/views/TodoManagerView.vue'
import TongzhiManagerView from '@/views/TongzhiManagerView.vue'
import UserManagerView from '@/views/UserManagerView.vue'
import { createRouter, createWebHashHistory } from 'vue-router'

const router = createRouter({
  history: createWebHashHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: LoginView,
    },
    {
      path: '/',
      name: 'layout',
      component: Layout,
      redirect: '/home', //重定向到 首页
      children: [
        //配置layout页面中router-view的 切换
        // 二级路由
        {
          path: '/home',
          name: 'home',
          component: HomeView,
        },
        {
          path: '/admin-user',
          name: 'admin-user',
          component: AdminUserManagerView,
        },

        {
          path: '/pro-man',
          name: 'pro-man',
          component: ProductManagerView,
        },
        {
          path: '/order-man',
          name: 'order-man',
          component: OrderManagerView,
        },
        {
          path: '/lunbo-man',
          name: 'lunbo-man',
          component: LunboManagerView,
        },
        {
          path: '/user-man',
          name: 'user-man',
          component: UserManagerView,
        },
        {
          path: '/ribao-man',
          name: 'ribao-man',
          component: RibaoManagerView,
        },
        {
          path: '/tongzhi-man',
          name: 'tongzhi-man',
          component: TongzhiManagerView,
        },
        {
          path: '/todo-man',
          name: 'todo-man',
          component: TodoManagerView,
        },
      ],
    },
  ],
})

export default router
